<?php

namespace app\admin\model;

use app\admin\traits\ScopeUniacid;
use app\common\model\TimeModel;
use think\facade\Db;

class KnscyTickets extends TimeModel
{

    protected $name = "tickets";

    protected $deleteTime = "delete_time";

    protected $globalScope = ['uniacid'];
    use ScopeUniacid;
    
    public function getStatusList()
    {
        return ['0'=>'禁用','1'=>'启用',];
    }
    public function getCanRefundList()
    {
        return ['0'=>'不可退','1'=>'可退',];
    }
    public function getNeedCheckList()
    {
        return ['0'=>'不需要换票','1'=>'需要换票',];
    }
    public static function getTicketTypeList()
    {
        return [ '1'=>'门票','2'=>'次卡','3'=>'年卡'];
    }
    public function setRemarkAttr($value)
    {
        return htmlspecialchars_decode($value);
    }

    public function getRemarkAttr($value)
    {
        return htmlspecialchars_decode($value);
    }

    //获取获取Transfer数据
    public static function getTransferJson()
    {
        $list = self::field('id,title')
             ->where('status',1)
            ->order(Db::raw('sort=0,sort asc,id desc'))
            ->select();
        $transferList = [];
        foreach ($list as $vo) {
            $transferList[] = [
                'value' => $vo['id'],
                'title' => '[' . $vo['id'] . ']' . $vo['title'],
            ];
        }
        return json_encode($transferList, JSON_UNESCAPED_UNICODE);
    }
}